home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / hypercar / mactool / parsefun.sit / Parse Functions / background_3763.xml < prev    next >
Encoding:
Extensible Markup Language  |  1991-06-18  |  14.6 KB  |  297 lines

  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <!DOCTYPE background PUBLIC "-//Apple, Inc.//DTD background V 2.0//EN" "" >
  3. <background>
  4.     <id>3763</id>
  5.     <filler1>0</filler1>
  6.     <bitmap>BMAP_4463.pbm</bitmap>
  7.     <cantDelete> <false /> </cantDelete>
  8.     <showPict> <true /> </showPict>
  9.     <dontSearch> <false /> </dontSearch>
  10.     <link rel="stylesheet" type="text/css" href="stylesheet_3098.css" />
  11.     <part>
  12.         <id>1</id>
  13.         <type>field</type>
  14.         <visible> <true /> </visible>
  15.         <dontWrap> <false /> </dontWrap>
  16.         <dontSearch> <false /> </dontSearch>
  17.         <sharedText> <false /> </sharedText>
  18.         <fixedLineHeight> <false /> </fixedLineHeight>
  19.         <autoTab> <false /> </autoTab>
  20.         <lockText> <false /> </lockText>
  21.         <rect>
  22.             <left>75</left>
  23.             <top>2</top>
  24.             <right>187</right>
  25.             <bottom>18</bottom>
  26.         </rect>
  27.         <style>rectangle</style>
  28.         <autoSelect> <false /> </autoSelect>
  29.         <showLines> <false /> </showLines>
  30.         <wideMargins> <false /> </wideMargins>
  31.         <multipleLines> <false /> </multipleLines>
  32.         <reservedFamily> 0 </reservedFamily>
  33.         <titleWidth>0</titleWidth>
  34.         <icon>0</icon>
  35.         <textAlign>left</textAlign>
  36.         <font>Geneva</font>
  37.         <textSize>9</textSize>
  38.         <textStyle>plain</textStyle>
  39.         <textHeight>12</textHeight>
  40.         <name>FileName</name>
  41.         <script></script>
  42.     </part>
  43.     <part>
  44.         <id>2</id>
  45.         <type>field</type>
  46.         <visible> <true /> </visible>
  47.         <dontWrap> <false /> </dontWrap>
  48.         <dontSearch> <false /> </dontSearch>
  49.         <sharedText> <false /> </sharedText>
  50.         <fixedLineHeight> <false /> </fixedLineHeight>
  51.         <autoTab> <false /> </autoTab>
  52.         <lockText> <false /> </lockText>
  53.         <rect>
  54.             <left>250</left>
  55.             <top>2</top>
  56.             <right>411</right>
  57.             <bottom>18</bottom>
  58.         </rect>
  59.         <style>rectangle</style>
  60.         <autoSelect> <false /> </autoSelect>
  61.         <showLines> <false /> </showLines>
  62.         <wideMargins> <false /> </wideMargins>
  63.         <multipleLines> <false /> </multipleLines>
  64.         <reservedFamily> 0 </reservedFamily>
  65.         <titleWidth>0</titleWidth>
  66.         <icon>0</icon>
  67.         <textAlign>left</textAlign>
  68.         <font>Geneva</font>
  69.         <textSize>9</textSize>
  70.         <textStyle>plain</textStyle>
  71.         <textHeight>12</textHeight>
  72.         <name>Returns</name>
  73.         <script></script>
  74.     </part>
  75.     <part>
  76.         <id>3</id>
  77.         <type>field</type>
  78.         <visible> <true /> </visible>
  79.         <dontWrap> <false /> </dontWrap>
  80.         <dontSearch> <false /> </dontSearch>
  81.         <sharedText> <false /> </sharedText>
  82.         <fixedLineHeight> <false /> </fixedLineHeight>
  83.         <autoTab> <false /> </autoTab>
  84.         <lockText> <false /> </lockText>
  85.         <rect>
  86.             <left>75</left>
  87.             <top>21</top>
  88.             <right>411</right>
  89.             <bottom>73</bottom>
  90.         </rect>
  91.         <style>scrolling</style>
  92.         <autoSelect> <false /> </autoSelect>
  93.         <showLines> <false /> </showLines>
  94.         <wideMargins> <false /> </wideMargins>
  95.         <multipleLines> <false /> </multipleLines>
  96.         <reservedFamily> 0 </reservedFamily>
  97.         <titleWidth>0</titleWidth>
  98.         <icon>0</icon>
  99.         <textAlign>left</textAlign>
  100.         <font>Geneva</font>
  101.         <textSize>9</textSize>
  102.         <textStyle>plain</textStyle>
  103.         <textHeight>12</textHeight>
  104.         <name>Prototype</name>
  105.         <script></script>
  106.     </part>
  107.     <part>
  108.         <id>4</id>
  109.         <type>button</type>
  110.         <visible> <true /> </visible>
  111.         <reserved5> 0 </reserved5>
  112.         <reserved4> 0 </reserved4>
  113.         <reserved3> 0 </reserved3>
  114.         <reserved2> 0 </reserved2>
  115.         <reserved1> 0 </reserved1>
  116.         <enabled> <true /> </enabled>
  117.         <rect>
  118.             <left>382</left>
  119.             <top>217</top>
  120.             <right>416</right>
  121.             <bottom>240</bottom>
  122.         </rect>
  123.         <style>transparent</style>
  124.         <showName> <false /> </showName>
  125.         <highlight> <false /> </highlight>
  126.         <autoHighlight> <true /> </autoHighlight>
  127.         <sharedHighlight> <true /> </sharedHighlight>
  128.         <family>0</family>
  129.         <titleWidth>0</titleWidth>
  130.         <icon>1013</icon>
  131.         <textAlign>center</textAlign>
  132.         <font>Chicago</font>
  133.         <textSize>12</textSize>
  134.         <textStyle>plain</textStyle>
  135.         <name>Next</name>
  136.         <script>on mouseUp
  137. go to next card
  138. end mouseUp</script>
  139.     </part>
  140.     <part>
  141.         <id>5</id>
  142.         <type>button</type>
  143.         <visible> <true /> </visible>
  144.         <reserved5> 0 </reserved5>
  145.         <reserved4> 0 </reserved4>
  146.         <reserved3> 0 </reserved3>
  147.         <reserved2> 0 </reserved2>
  148.         <reserved1> 0 </reserved1>
  149.         <enabled> <true /> </enabled>
  150.         <rect>
  151.             <left>0</left>
  152.             <top>216</top>
  153.             <right>25</right>
  154.             <bottom>240</bottom>
  155.         </rect>
  156.         <style>transparent</style>
  157.         <showName> <false /> </showName>
  158.         <highlight> <false /> </highlight>
  159.         <autoHighlight> <true /> </autoHighlight>
  160.         <sharedHighlight> <true /> </sharedHighlight>
  161.         <family>0</family>
  162.         <titleWidth>0</titleWidth>
  163.         <icon>1014</icon>
  164.         <textAlign>center</textAlign>
  165.         <font>Chicago</font>
  166.         <textSize>12</textSize>
  167.         <textStyle>plain</textStyle>
  168.         <name>Prev</name>
  169.         <script>on mouseUp
  170. go to previous card
  171. end mouseUp</script>
  172.     </part>
  173.     <part>
  174.         <id>6</id>
  175.         <type>button</type>
  176.         <visible> <true /> </visible>
  177.         <reserved5> 0 </reserved5>
  178.         <reserved4> 0 </reserved4>
  179.         <reserved3> 0 </reserved3>
  180.         <reserved2> 0 </reserved2>
  181.         <reserved1> 0 </reserved1>
  182.         <enabled> <true /> </enabled>
  183.         <rect>
  184.             <left>34</left>
  185.             <top>218</top>
  186.             <right>193</right>
  187.             <bottom>237</bottom>
  188.         </rect>
  189.         <style>shadow</style>
  190.         <showName> <true /> </showName>
  191.         <highlight> <false /> </highlight>
  192.         <autoHighlight> <true /> </autoHighlight>
  193.         <sharedHighlight> <true /> </sharedHighlight>
  194.         <family>0</family>
  195.         <titleWidth>0</titleWidth>
  196.         <icon>0</icon>
  197.         <textAlign>center</textAlign>
  198.         <font>Chicago</font>
  199.         <textSize>12</textSize>
  200.         <textStyle>plain</textStyle>
  201.         <name>Read Header Files</name>
  202.         <script>on mouseUp
  203. put false into multi
  204. put 0 into fileNumber
  205.  
  206. answer "Shall I go straight on and export the data after IΓÇÖve read it in?" ┬¼
  207. with "Yes", "No"
  208. if it is "Yes" then
  209. put true into batchMode
  210. else
  211. put false into batchMode
  212. end if
  213.  
  214. answer "Parse one file or the list from a folder?" with "Cancel",┬¼
  215. "Many", "One"
  216.  
  217. if it is "Cancel" then exit mouseUp
  218.  
  219. if it is "One" then
  220. answer file "C header file to parse:" of type "TEXT"
  221. if it is empty then exit mouseUp
  222. put it into fileName
  223. -- this function is in home and strips off the path
  224. put lastHCItem(":", fileName) into shortFileName
  225. put getPath(fileName) into path
  226.  
  227. end if
  228.  
  229. if it is "Many" then
  230. put true into multi
  231. put 1 into fileNumber
  232. answer file "Open any file in the source folder:" of type "TEXT"
  233. if it is empty then exit mouseUp
  234. put it into fileName
  235. -- this gets the path from the pull file and path
  236. put getPath(fileName) into path
  237. put files(path) into background fld "Files"
  238. put background fld "files" into fileList
  239.  
  240. end if
  241.  
  242. repeat
  243.  
  244. if multi then
  245. -- get the next file name from the list
  246. put line fileNumber of fileList into fileName
  247.  
  248. if fileName is empty then
  249. if batchMode then
  250. doExport "New TextBase"
  251. end if
  252. beep
  253. beep
  254. beep
  255. exit mouseUp
  256. end if
  257.  
  258. put fileName into shortFileName
  259. put path before fileName
  260. put fileNumber + 1 into fileNumber
  261. end if
  262.  
  263. open file fileName
  264. put "Reading file number: " & fileNumber -1 & " ΓÇ£" &fileName & "ΓÇ¥ΓǪ"
  265. read from file fileName until return
  266.  
  267. go to the last card of background "Protos"
  268.  
  269. repeat while it is not empty
  270. put it into line
  271. set cursor to busy
  272.  
  273. if isCfunction(line) then
  274. -- collect the function
  275. put offset(")", line) into closeBracketAt
  276. -- test for multi-line functions
  277. if closeBracketAt is 0 then
  278. read from file fileName until ")"
  279. put line & it & ";" into funcLine
  280. else
  281. -- handle single line function prototypes
  282. put character 1 to closeBracketAt of line & ";" into funcLine
  283. end if
  284.  
  285. -- replaces tabs with spaces
  286. put stripTabs(funcLine) into funcLine
  287.  
  288. -- remove the return types
  289. put offset("(", funcLine) into openBracketAt
  290. if openBracketAt is not zero then
  291.  
  292. -- scan back over spaces to find the function name
  293. repeat with i = openBracketAt down to 1
  294. if character i of funcLine is not space then exit repeat
  295. end repeat
  296.  
  297. -- scan back until we find the space before the function name
  298. repeat with i = i - 3 down to 1
  299. if character i of funcLine is space then exit repeat
  300. end repeat
  301.  
  302. put character 1 to i of funcLine into returnType
  303. delete character 1 to i of funcLine
  304. end if
  305.  
  306. -- now prepare to put the information in a card
  307. doMenu "New Card"
  308. put shortFileName into background field "FileName"
  309.  
  310. if word 1 of returnType is "pascal" then
  311. delete word 1 of returnType
  312. end if
  313. if word 1 of returnType is empty then
  314. put "void" into returnType
  315. end if
  316.  
  317. put returnType into background field "Returns"
  318.  
  319. -- strip off leading spaces
  320. repeat with i = 1 to the number of chars in funcLine
  321. if character 1 of funcLine is space or ┬¼
  322. character 1 of funcLine is tab then
  323. delete character 1 of funcLine
  324. else
  325. exit repeat
  326. end if
  327. end repeat
  328.  
  329. -- this gets rid of the carriage returns in the text
  330. repeat with i = 1 to the number of words in funcLine
  331. put word i of funcLine & space after background field "ProtoType"
  332. end repeat
  333.  
  334. end if
  335. read from file fileName until return
  336. end repeat -- no more lines to read
  337. if not multi then
  338. close file fileName
  339. hide msg
  340. exit mouseUp
  341. end if
  342. close file fileName
  343. end repeat -- reading multi files
  344. end mouseUp
  345.  
  346. -- This should be improved but works well enough for the MPW headers
  347. function isCfunction line
  348. if word 1 of line is "pascal" then
  349. return true
  350. else
  351. return false
  352. end if
  353. end isCfunction
  354.  
  355. -- replaces tabs with spaces
  356. function stripTabs line
  357. repeat with i = 1 to the number of characters in line
  358. if character i of line is tab then
  359. put space into character i of line
  360. end if
  361. end repeat
  362. return line
  363. end stripTabs
  364.  
  365. -- pinched from Home for completeness
  366. function lastHCItem delim,theText
  367. -- returns the portion of <theText> that follows the last <delim>
  368. if delim is in theText then
  369. put lastHCItem(delim,char offset(delim,theText) + 1 to ┬¼
  370. length(theText) of theText) into theText
  371. end if
  372. return theText
  373. end lastHCItem
  374.  
  375. function getPath theText
  376. -- returns the portion of <theText> up to the last <delim>
  377. repeat with i = the number of chars in theText down to 1
  378. if character i of theText is ":" then exit repeat
  379. end repeat
  380. return character 1 to i of theText
  381. end getPath
  382.  
  383. -- This sorts the cards by the function name
  384. -- outputs the text to a file with the words wrapped at the
  385. -- first word break after 65 characters are counted
  386. -- output is: functionName(parameters); // type  fileName.h
  387. -- By: Peter Marks Access Informatics (02) 555 8414
  388.  
  389. on doExport fileName
  390. sort by field "ProtoType"
  391. put "Sorting the stack, please waitΓǪ" into msg
  392.  
  393. open file fileName
  394. write "=" to file fileName
  395. repeat with i = 1 to the number of cards in this stack
  396. go to card i
  397. set cursor to busy
  398. put background fld "Prototype" & " // " & ┬¼
  399. background fld "returns" & ┬¼
  400. " <" & background fld "fileName" & ">|" into outLine
  401.  
  402. -- write out the text, wrapping at the first word after 61 chars wide
  403. put false into break
  404. repeat with j = 1 to the number of characters in outline
  405. if break and character j of outline is space then
  406. write return to file fileName
  407. put false into break
  408. end if
  409. write character j of outline to file fileName
  410. if j mod 61 is zero then
  411. put true into break -- break when you can!
  412. set cursor to busy
  413. end if
  414. end repeat
  415. write return to file fileName
  416.  
  417. end repeat
  418. write "=" to file fileName
  419. close file fileName
  420. beep
  421. end doExport</script>
  422.     </part>
  423.     <part>
  424.         <id>7</id>
  425.         <type>field</type>
  426.         <visible> <true /> </visible>
  427.         <dontWrap> <false /> </dontWrap>
  428.         <dontSearch> <false /> </dontSearch>
  429.         <sharedText> <false /> </sharedText>
  430.         <fixedLineHeight> <false /> </fixedLineHeight>
  431.         <autoTab> <false /> </autoTab>
  432.         <lockText> <true /> </lockText>
  433.         <rect>
  434.             <left>85</left>
  435.             <top>139</top>
  436.             <right>217</right>
  437.             <bottom>203</bottom>
  438.         </rect>
  439.         <style>scrolling</style>
  440.         <autoSelect> <false /> </autoSelect>
  441.         <showLines> <false /> </showLines>
  442.         <wideMargins> <false /> </wideMargins>
  443.         <multipleLines> <false /> </multipleLines>
  444.         <reservedFamily> 0 </reservedFamily>
  445.         <titleWidth>0</titleWidth>
  446.         <icon>0</icon>
  447.         <textAlign>left</textAlign>
  448.         <font>Geneva</font>
  449.         <textSize>9</textSize>
  450.         <textStyle>plain</textStyle>
  451.         <textHeight>12</textHeight>
  452.         <name>Files</name>
  453.         <script></script>
  454.     </part>
  455.     <part>
  456.         <id>8</id>
  457.         <type>button</type>
  458.         <visible> <true /> </visible>
  459.         <reserved5> 0 </reserved5>
  460.         <reserved4> 0 </reserved4>
  461.         <reserved3> 0 </reserved3>
  462.         <reserved2> 0 </reserved2>
  463.         <reserved1> 0 </reserved1>
  464.         <enabled> <true /> </enabled>
  465.         <rect>
  466.             <left>2</left>
  467.             <top>180</top>
  468.             <right>82</right>
  469.             <bottom>202</bottom>
  470.         </rect>
  471.         <style>shadow</style>
  472.         <showName> <true /> </showName>
  473.         <highlight> <false /> </highlight>
  474.         <autoHighlight> <true /> </autoHighlight>
  475.         <sharedHighlight> <true /> </sharedHighlight>
  476.         <family>0</family>
  477.         <titleWidth>0</titleWidth>
  478.         <icon>0</icon>
  479.         <textAlign>center</textAlign>
  480.         <font>Geneva</font>
  481.         <textSize>9</textSize>
  482.         <textStyle>plain</textStyle>
  483.         <name>Delete Cards</name>
  484.         <script>on mouseUp
  485. answer "Do you want to delete all data from this stack?" with ┬¼
  486. "Yes", "Cancel"
  487. if it is "Cancel" then exit mouseUp
  488.  
  489. repeat with i = 2 to the number of cards in this stack
  490. go to card 2
  491. doMenu "Delete Card"
  492. set cursor to busy
  493. end repeat
  494. end mouseUp</script>
  495.     </part>
  496.     <part>
  497.         <id>9</id>
  498.         <type>button</type>
  499.         <visible> <true /> </visible>
  500.         <reserved5> 0 </reserved5>
  501.         <reserved4> 0 </reserved4>
  502.         <reserved3> 0 </reserved3>
  503.         <reserved2> 0 </reserved2>
  504.         <reserved1> 0 </reserved1>
  505.         <enabled> <true /> </enabled>
  506.         <rect>
  507.             <left>199</left>
  508.             <top>218</top>
  509.             <right>379</right>
  510.             <bottom>237</bottom>
  511.         </rect>
  512.         <style>shadow</style>
  513.         <showName> <true /> </showName>
  514.         <highlight> <false /> </highlight>
  515.         <autoHighlight> <true /> </autoHighlight>
  516.         <sharedHighlight> <true /> </sharedHighlight>
  517.         <family>0</family>
  518.         <titleWidth>0</titleWidth>
  519.         <icon>0</icon>
  520.         <textAlign>center</textAlign>
  521.         <font>Chicago</font>
  522.         <textSize>12</textSize>
  523.         <textStyle>plain</textStyle>
  524.         <name>Export To OnBase</name>
  525.         <script>-- This sorts the cards by the function name
  526. -- outputs the text to a file with the words wrapped at the
  527. -- first word break after 65 characters are counted
  528. -- output is: functionName(parameters); // type  fileName.h
  529. -- By: Peter Marks Access Informatics (02) 555 8414
  530.  
  531. on mouseUp
  532. ask file "Name your export file:" with "TextBase"
  533. if it is empty then exit mouseUp
  534. put it into fileName
  535. sort by field "ProtoType"
  536. put "Sorting the stack, please waitΓǪ" into msg
  537.  
  538. open file fileName
  539. write "=" to file fileName
  540. repeat with i = 2 to the number of cards in this stack
  541. go to card i
  542. set cursor to busy
  543. put background fld "Prototype" & " // " & ┬¼
  544. background fld "returns" & ┬¼
  545. " <" & background fld "fileName" & ">|" into outLine
  546.  
  547. -- write out the text, wrapping at the first word after 61 chars wide
  548. put false into break
  549. repeat with j = 1 to the number of characters in outline
  550. if break and character j of outline is space then
  551. write return to file fileName
  552. put false into break
  553. end if
  554. write character j of outline to file fileName
  555. if j mod 61 is zero then
  556. put true into break -- break when you can!
  557. set cursor to busy
  558. end if
  559. end repeat
  560. write return to file fileName
  561.  
  562. end repeat
  563. write "=" to file fileName
  564. close file fileName
  565. beep
  566. end mouseUp</script>
  567.     </part>
  568.     <name>Protos</name>
  569.     <script></script>
  570. </background>
  571.